<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-comment">-- | Graph coloring register allocator.</span><span>
</span><span id="line-5"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.CmmToAsm.Reg.Graph</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-6"></span><span>        </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#regAlloc"><span class="hs-identifier">regAlloc</span></a></span><span>
</span><span id="line-7"></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-8"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-9"></span><span>
</span><span id="line-10"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Color.html"><span class="hs-identifier">GHC.Data.Graph.Color</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Color</span></span><span>
</span><span id="line-11"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Liveness</span></a></span><span>
</span><span id="line-12"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.Spill.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Graph.Spill</span></a></span><span>
</span><span id="line-13"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.SpillClean.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Graph.SpillClean</span></a></span><span>
</span><span id="line-14"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.SpillCost.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Graph.SpillCost</span></a></span><span>
</span><span id="line-15"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.Stats.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Graph.Stats</span></a></span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.TrivColorable.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Graph.TrivColorable</span></a></span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html"><span class="hs-identifier">GHC.CmmToAsm.Instr</span></a></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Target.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Target</span></a></span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Config.html"><span class="hs-identifier">GHC.CmmToAsm.Config</span></a></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html"><span class="hs-identifier">GHC.Platform.Reg.Class</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html"><span class="hs-identifier">GHC.Platform.Reg</span></a></span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html"><span class="hs-identifier">GHC.Data.Bag</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#"><span class="hs-identifier">GHC.Platform</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html"><span class="hs-identifier">GHC.Types.Unique.Set</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html"><span class="hs-identifier">GHC.Types.Unique.Supply</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Misc.html#seqList"><span class="hs-identifier">seqList</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.CFG.html"><span class="hs-identifier">GHC.CmmToAsm.CFG</span></a></span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-34"></span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span class="hs-comment">-- | The maximum number of build\/spill cycles we'll allow.</span><span>
</span><span id="line-37"></span><span class="hs-comment">--</span><span>
</span><span id="line-38"></span><span class="hs-comment">--   It should only take 3 or 4 cycles for the allocator to converge.</span><span>
</span><span id="line-39"></span><span class="hs-comment">--   If it takes any longer than this it's probably in an infinite loop,</span><span>
</span><span id="line-40"></span><span class="hs-comment">--   so it's better just to bail out and report a bug.</span><span>
</span><span id="line-41"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#maxSpinCount"><span class="hs-identifier hs-type">maxSpinCount</span></a></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-42"></span><span id="maxSpinCount"><span class="annot"><span class="annottext">maxSpinCount :: Int
</span><a href="GHC.CmmToAsm.Reg.Graph.html#maxSpinCount"><span class="hs-identifier hs-var hs-var">maxSpinCount</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">10</span></span><span>
</span><span id="line-43"></span><span>
</span><span id="line-44"></span><span>
</span><span id="line-45"></span><span class="hs-comment">-- | The top level of the graph coloring register allocator.</span><span>
</span><span id="line-46"></span><span id="local-6989586621681026129"><span id="local-6989586621681026131"><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#regAlloc"><span class="hs-identifier hs-type">regAlloc</span></a></span><span>
</span><span id="line-47"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026131"><span class="hs-identifier hs-type">statics</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026129"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026129"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-48"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Config.html#NCGConfig"><span class="hs-identifier hs-type">NCGConfig</span></a></span><span>
</span><span id="line-49"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.Set.html#UniqSet"><span class="hs-identifier hs-type">UniqSet</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">)</span><span>     </span><span class="hs-comment">-- ^ registers we can use for allocation</span><span>
</span><span id="line-50"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html#UniqSet"><span class="hs-identifier hs-type">UniqSet</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>                  </span><span class="hs-comment">-- ^ set of available spill slots.</span><span>
</span><span id="line-51"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>                          </span><span class="hs-comment">-- ^ current number of spill slots</span><span>
</span><span id="line-52"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveCmmDecl"><span class="hs-identifier hs-type">LiveCmmDecl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026131"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026129"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- ^ code annotated with liveness information.</span><span>
</span><span id="line-53"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.CFG.html#CFG"><span class="hs-identifier hs-type">CFG</span></a></span><span>                    </span><span class="hs-comment">-- ^ CFG of basic blocks if available</span><span>
</span><span id="line-54"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html#UniqSM"><span class="hs-identifier hs-type">UniqSM</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatCmmDecl"><span class="hs-identifier hs-type">NatCmmDecl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026131"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026129"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-55"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#RegAllocStats"><span class="hs-identifier hs-type">RegAllocStats</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026131"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026129"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">)</span></span></span><span>
</span><span id="line-56"></span><span>           </span><span class="hs-comment">-- ^ code with registers allocated, additional stacks required</span><span>
</span><span id="line-57"></span><span>           </span><span class="hs-comment">-- and stats for each stage of allocation</span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span id="regAlloc"><span class="annot"><span class="annottext">regAlloc :: forall statics instr.
(Outputable statics, Outputable instr, Instruction instr) =&gt;
NCGConfig
-&gt; UniqFM RegClass (UniqSet RealReg)
-&gt; UniqSet Int
-&gt; Int
-&gt; [LiveCmmDecl statics instr]
-&gt; Maybe CFG
-&gt; UniqSM
     ([NatCmmDecl statics instr], Maybe Int,
      [RegAllocStats statics instr])
</span><a href="GHC.CmmToAsm.Reg.Graph.html#regAlloc"><span class="hs-identifier hs-var hs-var">regAlloc</span></a></span></span><span> </span><span id="local-6989586621681025947"><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025947"><span class="hs-identifier hs-var">config</span></a></span></span><span> </span><span id="local-6989586621681025946"><span class="annot"><span class="annottext">UniqFM RegClass (UniqSet RealReg)
</span><a href="#local-6989586621681025946"><span class="hs-identifier hs-var">regsFree</span></a></span></span><span> </span><span id="local-6989586621681025945"><span class="annot"><span class="annottext">UniqSet Int
</span><a href="#local-6989586621681025945"><span class="hs-identifier hs-var">slotsFree</span></a></span></span><span> </span><span id="local-6989586621681025944"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025944"><span class="hs-identifier hs-var">slotsCount</span></a></span></span><span> </span><span id="local-6989586621681025943"><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025943"><span class="hs-identifier hs-var">code</span></a></span></span><span> </span><span id="local-6989586621681025942"><span class="annot"><span class="annottext">Maybe CFG
</span><a href="#local-6989586621681025942"><span class="hs-identifier hs-var">cfg</span></a></span></span><span>
</span><span id="line-60"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-61"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025941"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681025941"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Platform
</span><a href="GHC.CmmToAsm.Config.html#ncgPlatform"><span class="hs-identifier hs-var hs-var">ncgPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025947"><span class="hs-identifier hs-var">config</span></a></span><span>
</span><span id="line-62"></span><span>            </span><span id="local-6989586621681025939"><span class="annot"><span class="annottext">triv :: Triv VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025939"><span class="hs-identifier hs-var hs-var">triv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform
-&gt; (RegClass -&gt; VirtualReg -&gt; Int)
-&gt; (RegClass -&gt; RealReg -&gt; Int)
-&gt; Triv VirtualReg RegClass RealReg
</span><a href="GHC.CmmToAsm.Reg.Graph.TrivColorable.html#trivColorable"><span class="hs-identifier hs-var">trivColorable</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025941"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-63"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; RegClass -&gt; VirtualReg -&gt; Int
</span><a href="GHC.CmmToAsm.Reg.Target.html#targetVirtualRegSqueeze"><span class="hs-identifier hs-var">targetVirtualRegSqueeze</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025941"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-64"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; RegClass -&gt; RealReg -&gt; Int
</span><a href="GHC.CmmToAsm.Reg.Target.html#targetRealRegSqueeze"><span class="hs-identifier hs-var">targetRealRegSqueeze</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025941"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681025935"><span class="annot"><span class="annottext">[NatCmmDecl statics instr]
</span><a href="#local-6989586621681025935"><span class="hs-identifier hs-var">code_final</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681025934"><span class="annot"><span class="annottext">[RegAllocStats statics instr]
</span><a href="#local-6989586621681025934"><span class="hs-identifier hs-var">debug_codeGraphs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681025933"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025933"><span class="hs-identifier hs-var">slotsCount'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-67"></span><span>                </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">NCGConfig
-&gt; Int
-&gt; Triv VirtualReg RegClass RealReg
-&gt; UniqFM RegClass (UniqSet RealReg)
-&gt; UniqSet Int
-&gt; Int
-&gt; [RegAllocStats statics instr]
-&gt; [LiveCmmDecl statics instr]
-&gt; Maybe CFG
-&gt; UniqSM
     ([NatCmmDecl statics instr], [RegAllocStats statics instr], Int,
      Graph VirtualReg RegClass RealReg)
forall instr statics.
(Instruction instr, Outputable instr, Outputable statics) =&gt;
NCGConfig
-&gt; Int
-&gt; Triv VirtualReg RegClass RealReg
-&gt; UniqFM RegClass (UniqSet RealReg)
-&gt; UniqSet Int
-&gt; Int
-&gt; [RegAllocStats statics instr]
-&gt; [LiveCmmDecl statics instr]
-&gt; Maybe CFG
-&gt; UniqSM
     ([NatCmmDecl statics instr], [RegAllocStats statics instr], Int,
      Graph VirtualReg RegClass RealReg)
</span><a href="GHC.CmmToAsm.Reg.Graph.html#regAlloc_spin"><span class="hs-identifier hs-var">regAlloc_spin</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025947"><span class="hs-identifier hs-var">config</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-68"></span><span>                        </span><span class="annot"><span class="annottext">Triv VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025939"><span class="hs-identifier hs-var">triv</span></a></span><span>
</span><span id="line-69"></span><span>                        </span><span class="annot"><span class="annottext">UniqFM RegClass (UniqSet RealReg)
</span><a href="#local-6989586621681025946"><span class="hs-identifier hs-var">regsFree</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet Int
</span><a href="#local-6989586621681025945"><span class="hs-identifier hs-var">slotsFree</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025944"><span class="hs-identifier hs-var">slotsCount</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025943"><span class="hs-identifier hs-var">code</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe CFG
</span><a href="#local-6989586621681025942"><span class="hs-identifier hs-var">cfg</span></a></span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025929"><span class="annot"><span class="annottext">needStack :: Maybe Int
</span><a href="#local-6989586621681025929"><span class="hs-identifier hs-var hs-var">needStack</span></a></span></span><span>
</span><span id="line-72"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025944"><span class="hs-identifier hs-var">slotsCount</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025933"><span class="hs-identifier hs-var">slotsCount'</span></a></span><span>
</span><span id="line-73"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Int
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-74"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-75"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Maybe Int
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025933"><span class="hs-identifier hs-var">slotsCount'</span></a></span><span>
</span><span id="line-76"></span><span>
</span><span id="line-77"></span><span>        </span><span class="annot"><span class="annottext">([NatCmmDecl statics instr], Maybe Int,
 [RegAllocStats statics instr])
-&gt; UniqSM
     ([NatCmmDecl statics instr], Maybe Int,
      [RegAllocStats statics instr])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">[NatCmmDecl statics instr]
</span><a href="#local-6989586621681025935"><span class="hs-identifier hs-var">code_final</span></a></span><span>
</span><span id="line-78"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe Int
</span><a href="#local-6989586621681025929"><span class="hs-identifier hs-var">needStack</span></a></span><span>
</span><span id="line-79"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[RegAllocStats statics instr] -&gt; [RegAllocStats statics instr]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[RegAllocStats statics instr]
</span><a href="#local-6989586621681025934"><span class="hs-identifier hs-var">debug_codeGraphs</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-80"></span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span class="hs-comment">-- | Perform solver iterations for the graph coloring allocator.</span><span>
</span><span id="line-83"></span><span class="hs-comment">--</span><span>
</span><span id="line-84"></span><span class="hs-comment">--   We extract a register conflict graph from the provided cmm code,</span><span>
</span><span id="line-85"></span><span class="hs-comment">--   and try to colour it. If that works then we use the solution rewrite</span><span>
</span><span id="line-86"></span><span class="hs-comment">--   the code with real hregs. If coloring doesn't work we add spill code</span><span>
</span><span id="line-87"></span><span class="hs-comment">--   and try to colour it again. After `maxSpinCount` iterations we give up.</span><span>
</span><span id="line-88"></span><span class="hs-comment">--</span><span>
</span><span id="line-89"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#regAlloc_spin"><span class="hs-identifier hs-type">regAlloc_spin</span></a></span><span>
</span><span id="line-90"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621681026112"><span class="annot"><a href="#local-6989586621681026112"><span class="hs-identifier hs-type">instr</span></a></span></span><span> </span><span id="local-6989586621681026111"><span class="annot"><a href="#local-6989586621681026111"><span class="hs-identifier hs-type">statics</span></a></span></span><span class="hs-operator">.</span><span>
</span><span id="line-91"></span><span>           </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026112"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-92"></span><span>            </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026112"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-93"></span><span>            </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026111"><span class="hs-identifier hs-type">statics</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-94"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Config.html#NCGConfig"><span class="hs-identifier hs-type">NCGConfig</span></a></span><span>
</span><span id="line-95"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>  </span><span class="hs-comment">-- ^ Number of solver iterations we've already performed.</span><span>
</span><span id="line-96"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Triv"><span class="hs-identifier hs-type">Color.Triv</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span>
</span><span id="line-97"></span><span>                </span><span class="hs-comment">-- ^ Function for calculating whether a register is trivially</span><span>
</span><span id="line-98"></span><span>                </span><span class="hs-comment">--   colourable.</span><span>
</span><span id="line-99"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.Set.html#UniqSet"><span class="hs-identifier hs-type">UniqSet</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">)</span><span>      </span><span class="hs-comment">-- ^ Free registers that we can allocate.</span><span>
</span><span id="line-100"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html#UniqSet"><span class="hs-identifier hs-type">UniqSet</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>                   </span><span class="hs-comment">-- ^ Free stack slots that we can use.</span><span>
</span><span id="line-101"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>                           </span><span class="hs-comment">-- ^ Number of spill slots in use</span><span>
</span><span id="line-102"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#RegAllocStats"><span class="hs-identifier hs-type">RegAllocStats</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026111"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026112"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- ^ Current regalloc stats to add to.</span><span>
</span><span id="line-103"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveCmmDecl"><span class="hs-identifier hs-type">LiveCmmDecl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026111"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026112"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-comment">-- ^ Liveness annotated code to allocate.</span><span>
</span><span id="line-104"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.CFG.html#CFG"><span class="hs-identifier hs-type">CFG</span></a></span><span>
</span><span id="line-105"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html#UniqSM"><span class="hs-identifier hs-type">UniqSM</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#NatCmmDecl"><span class="hs-identifier hs-type">NatCmmDecl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026111"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026112"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-106"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#RegAllocStats"><span class="hs-identifier hs-type">RegAllocStats</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026111"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026112"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-107"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>                  </span><span class="hs-comment">-- Slots in use</span><span>
</span><span id="line-108"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Color.Graph</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span id="regAlloc_spin"><span class="annot"><span class="annottext">regAlloc_spin :: forall instr statics.
(Instruction instr, Outputable instr, Outputable statics) =&gt;
NCGConfig
-&gt; Int
-&gt; Triv VirtualReg RegClass RealReg
-&gt; UniqFM RegClass (UniqSet RealReg)
-&gt; UniqSet Int
-&gt; Int
-&gt; [RegAllocStats statics instr]
-&gt; [LiveCmmDecl statics instr]
-&gt; Maybe CFG
-&gt; UniqSM
     ([NatCmmDecl statics instr], [RegAllocStats statics instr], Int,
      Graph VirtualReg RegClass RealReg)
</span><a href="GHC.CmmToAsm.Reg.Graph.html#regAlloc_spin"><span class="hs-identifier hs-var hs-var">regAlloc_spin</span></a></span></span><span> </span><span id="local-6989586621681025890"><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025890"><span class="hs-identifier hs-var">config</span></a></span></span><span> </span><span id="local-6989586621681025889"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025889"><span class="hs-identifier hs-var">spinCount</span></a></span></span><span> </span><span id="local-6989586621681025888"><span class="annot"><span class="annottext">Triv VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025888"><span class="hs-identifier hs-var">triv</span></a></span></span><span> </span><span id="local-6989586621681025887"><span class="annot"><span class="annottext">UniqFM RegClass (UniqSet RealReg)
</span><a href="#local-6989586621681025887"><span class="hs-identifier hs-var">regsFree</span></a></span></span><span> </span><span id="local-6989586621681025886"><span class="annot"><span class="annottext">UniqSet Int
</span><a href="#local-6989586621681025886"><span class="hs-identifier hs-var">slotsFree</span></a></span></span><span> </span><span id="local-6989586621681025885"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025885"><span class="hs-identifier hs-var">slotsCount</span></a></span></span><span> </span><span id="local-6989586621681025884"><span class="annot"><span class="annottext">[RegAllocStats statics instr]
</span><a href="#local-6989586621681025884"><span class="hs-identifier hs-var">debug_codeGraphs</span></a></span></span><span> </span><span id="local-6989586621681025883"><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025883"><span class="hs-identifier hs-var">code</span></a></span></span><span> </span><span id="local-6989586621681025882"><span class="annot"><span class="annottext">Maybe CFG
</span><a href="#local-6989586621681025882"><span class="hs-identifier hs-var">cfg</span></a></span></span><span>
</span><span id="line-111"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-112"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025881"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681025881"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Platform
</span><a href="GHC.CmmToAsm.Config.html#ncgPlatform"><span class="hs-identifier hs-var hs-var">ncgPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025890"><span class="hs-identifier hs-var">config</span></a></span><span>
</span><span id="line-113"></span><span>
</span><span id="line-114"></span><span>        </span><span class="hs-comment">-- If any of these dump flags are turned on we want to hang on to</span><span>
</span><span id="line-115"></span><span>        </span><span class="hs-comment">-- intermediate structures in the allocator - otherwise tell the</span><span>
</span><span id="line-116"></span><span>        </span><span class="hs-comment">-- allocator to ditch them early so we don't end up creating space leaks.</span><span>
</span><span id="line-117"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025878"><span class="annot"><span class="annottext">dump :: Bool
</span><a href="#local-6989586621681025878"><span class="hs-identifier hs-var hs-var">dump</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; Bool
forall (t :: * -&gt; *). Foldable t =&gt; t Bool -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#or"><span class="hs-identifier hs-var">or</span></a></span><span>
</span><span id="line-118"></span><span>                </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Bool
</span><a href="GHC.CmmToAsm.Config.html#ncgDumpRegAllocStages"><span class="hs-identifier hs-var hs-var">ncgDumpRegAllocStages</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025890"><span class="hs-identifier hs-var">config</span></a></span><span>
</span><span id="line-119"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Bool
</span><a href="GHC.CmmToAsm.Config.html#ncgDumpAsmStats"><span class="hs-identifier hs-var hs-var">ncgDumpAsmStats</span></a></span><span>       </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025890"><span class="hs-identifier hs-var">config</span></a></span><span>
</span><span id="line-120"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Bool
</span><a href="GHC.CmmToAsm.Config.html#ncgDumpAsmConflicts"><span class="hs-identifier hs-var hs-var">ncgDumpAsmConflicts</span></a></span><span>   </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025890"><span class="hs-identifier hs-var">config</span></a></span><span>
</span><span id="line-121"></span><span>                </span><span class="hs-special">]</span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span>        </span><span class="hs-comment">-- Check that we're not running off down the garden path.</span><span>
</span><span id="line-124"></span><span>        </span><span class="annot"><span class="annottext">Bool -&gt; UniqSM () -&gt; UniqSM ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025889"><span class="hs-identifier hs-var">spinCount</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="GHC.CmmToAsm.Reg.Graph.html#maxSpinCount"><span class="hs-identifier hs-var">maxSpinCount</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-125"></span><span>         </span><span class="annot"><span class="annottext">(UniqSM () -&gt; UniqSM ()) -&gt; UniqSM () -&gt; UniqSM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; UniqSM ()
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;regAlloc_spin: max build/spill cycle count exceeded.&quot;</span></span><span>
</span><span id="line-126"></span><span>           </span><span class="hs-special">(</span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;It looks like the register allocator is stuck in an infinite loop.&quot;</span></span><span>
</span><span id="line-127"></span><span>           </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;max cycles  = &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#int"><span class="hs-identifier hs-var">int</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="GHC.CmmToAsm.Reg.Graph.html#maxSpinCount"><span class="hs-identifier hs-var">maxSpinCount</span></a></span><span>
</span><span id="line-128"></span><span>           </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;regsFree    = &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hcat"><span class="hs-identifier hs-var">hcat</span></a></span><span> </span><span class="annot"><span class="annottext">([SDoc] -&gt; SDoc) -&gt; [SDoc] -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; [SDoc] -&gt; [SDoc]
</span><a href="GHC.Utils.Outputable.html#punctuate"><span class="hs-identifier hs-var">punctuate</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#space"><span class="hs-identifier hs-var">space</span></a></span><span> </span><span class="annot"><span class="annottext">([SDoc] -&gt; [SDoc]) -&gt; [SDoc] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(RealReg -&gt; SDoc) -&gt; [RealReg] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span>
</span><span id="line-129"></span><span>                                             </span><span class="annot"><span class="annottext">([RealReg] -&gt; [SDoc]) -&gt; [RealReg] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet RealReg -&gt; [RealReg]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqSet RealReg -&gt; [RealReg]) -&gt; UniqSet RealReg -&gt; [RealReg]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[UniqSet RealReg] -&gt; UniqSet RealReg
forall a. [UniqSet a] -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#unionManyUniqSets"><span class="hs-identifier hs-var">unionManyUniqSets</span></a></span><span>
</span><span id="line-130"></span><span>                                             </span><span class="annot"><span class="annottext">([UniqSet RealReg] -&gt; UniqSet RealReg)
-&gt; [UniqSet RealReg] -&gt; UniqSet RealReg
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM RegClass (UniqSet RealReg) -&gt; [UniqSet RealReg]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#nonDetEltsUFM"><span class="hs-identifier hs-var">nonDetEltsUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM RegClass (UniqSet RealReg)
</span><a href="#local-6989586621681025887"><span class="hs-identifier hs-var">regsFree</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-131"></span><span>              </span><span class="hs-comment">-- This is non-deterministic but we do not</span><span>
</span><span id="line-132"></span><span>              </span><span class="hs-comment">-- currently support deterministic code-generation.</span><span>
</span><span id="line-133"></span><span>              </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-134"></span><span>           </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;slotsFree   = &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqSet Int -&gt; Int
forall a. UniqSet a -&gt; Int
</span><a href="GHC.Types.Unique.Set.html#sizeUniqSet"><span class="hs-identifier hs-var">sizeUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet Int
</span><a href="#local-6989586621681025886"><span class="hs-identifier hs-var">slotsFree</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-135"></span><span>
</span><span id="line-136"></span><span>        </span><span class="hs-comment">-- Build the register conflict graph from the cmm code.</span><span>
</span><span id="line-137"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681025858"><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025858"><span class="hs-identifier hs-var">graph</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Color.Graph</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-138"></span><span>                </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;BuildGraph&quot;</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
-&gt; UniqSM (Graph VirtualReg RegClass RealReg)
forall instr statics.
Instruction instr =&gt;
[LiveCmmDecl statics instr]
-&gt; UniqSM (Graph VirtualReg RegClass RealReg)
</span><a href="GHC.CmmToAsm.Reg.Graph.html#buildGraph"><span class="hs-identifier hs-var">buildGraph</span></a></span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025883"><span class="hs-identifier hs-var">code</span></a></span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span>        </span><span class="hs-comment">-- VERY IMPORTANT:</span><span>
</span><span id="line-141"></span><span>        </span><span class="hs-comment">--   We really do want the graph to be fully evaluated _before_ we</span><span>
</span><span id="line-142"></span><span>        </span><span class="hs-comment">--   start coloring. If we don't do this now then when the call to</span><span>
</span><span id="line-143"></span><span>        </span><span class="hs-comment">--   Color.colorGraph forces bits of it, the heap will be filled with</span><span>
</span><span id="line-144"></span><span>        </span><span class="hs-comment">--   half evaluated pieces of graph and zillions of apply thunks.</span><span>
</span><span id="line-145"></span><span>        </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqGraph"><span class="hs-identifier hs-var">seqGraph</span></a></span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025858"><span class="hs-identifier hs-var">graph</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; UniqSM () -&gt; UniqSM ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">() -&gt; UniqSM ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-146"></span><span>
</span><span id="line-147"></span><span>        </span><span class="hs-comment">-- Build a map of the cost of spilling each instruction.</span><span>
</span><span id="line-148"></span><span>        </span><span class="hs-comment">-- This is a lazy binding, so the map will only be computed if we</span><span>
</span><span id="line-149"></span><span>        </span><span class="hs-comment">-- actually have to spill to the stack.</span><span>
</span><span id="line-150"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025852"><span class="annot"><span class="annottext">spillCosts :: SpillCostInfo
</span><a href="#local-6989586621681025852"><span class="hs-identifier hs-var hs-var">spillCosts</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(SpillCostInfo -&gt; SpillCostInfo -&gt; SpillCostInfo)
-&gt; SpillCostInfo -&gt; [SpillCostInfo] -&gt; SpillCostInfo
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">SpillCostInfo -&gt; SpillCostInfo -&gt; SpillCostInfo
</span><a href="GHC.CmmToAsm.Reg.Graph.SpillCost.html#plusSpillCostInfo"><span class="hs-identifier hs-var">plusSpillCostInfo</span></a></span><span> </span><span class="annot"><span class="annottext">SpillCostInfo
</span><a href="GHC.CmmToAsm.Reg.Graph.SpillCost.html#zeroSpillCostInfo"><span class="hs-identifier hs-var">zeroSpillCostInfo</span></a></span><span>
</span><span id="line-151"></span><span>                        </span><span class="annot"><span class="annottext">([SpillCostInfo] -&gt; SpillCostInfo)
-&gt; [SpillCostInfo] -&gt; SpillCostInfo
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(LiveCmmDecl statics instr -&gt; SpillCostInfo)
-&gt; [LiveCmmDecl statics instr] -&gt; [SpillCostInfo]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; Maybe CFG -&gt; LiveCmmDecl statics instr -&gt; SpillCostInfo
forall instr statics.
(Outputable instr, Instruction instr) =&gt;
Platform -&gt; Maybe CFG -&gt; LiveCmmDecl statics instr -&gt; SpillCostInfo
</span><a href="GHC.CmmToAsm.Reg.Graph.SpillCost.html#slurpSpillCostInfo"><span class="hs-identifier hs-var">slurpSpillCostInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025881"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe CFG
</span><a href="#local-6989586621681025882"><span class="hs-identifier hs-var">cfg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025883"><span class="hs-identifier hs-var">code</span></a></span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span>        </span><span class="hs-comment">-- The function to choose regs to leave uncolored.</span><span>
</span><span id="line-154"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025847"><span class="annot"><span class="annottext">spill :: Graph VirtualReg RegClass RealReg -&gt; VirtualReg
</span><a href="#local-6989586621681025847"><span class="hs-identifier hs-var hs-var">spill</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SpillCostInfo -&gt; Graph VirtualReg RegClass RealReg -&gt; VirtualReg
</span><a href="GHC.CmmToAsm.Reg.Graph.SpillCost.html#chooseSpill"><span class="hs-identifier hs-var">chooseSpill</span></a></span><span> </span><span class="annot"><span class="annottext">SpillCostInfo
</span><a href="#local-6989586621681025852"><span class="hs-identifier hs-var">spillCosts</span></a></span><span>
</span><span id="line-155"></span><span>
</span><span id="line-156"></span><span>        </span><span class="hs-comment">-- Record startup state in our log.</span><span>
</span><span id="line-157"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025843"><span class="annot"><span class="annottext">stat1 :: Maybe (RegAllocStats statics instr)
</span><a href="#local-6989586621681025843"><span class="hs-identifier hs-var hs-var">stat1</span></a></span></span><span>
</span><span id="line-158"></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025889"><span class="hs-identifier hs-var">spinCount</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-159"></span><span>                 </span><span class="hs-keyword">then</span><span>   </span><span class="annot"><span class="annottext">RegAllocStats statics instr -&gt; Maybe (RegAllocStats statics instr)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(RegAllocStats statics instr
 -&gt; Maybe (RegAllocStats statics instr))
-&gt; RegAllocStats statics instr
-&gt; Maybe (RegAllocStats statics instr)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">RegAllocStatsStart :: forall statics instr.
[LiveCmmDecl statics instr]
-&gt; Graph VirtualReg RegClass RealReg
-&gt; SpillCostInfo
-&gt; Platform
-&gt; RegAllocStats statics instr
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#RegAllocStatsStart"><span class="hs-identifier hs-type">RegAllocStatsStart</span></a></span><span>
</span><span id="line-160"></span><span>                        </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">raLiveCmm :: [LiveCmmDecl statics instr]
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raLiveCmm"><span class="hs-identifier hs-var">raLiveCmm</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025883"><span class="hs-identifier hs-var">code</span></a></span><span>
</span><span id="line-161"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raGraph :: Graph VirtualReg RegClass RealReg
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raGraph"><span class="hs-identifier hs-var">raGraph</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025858"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-162"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raSpillCosts :: SpillCostInfo
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raSpillCosts"><span class="hs-identifier hs-var">raSpillCosts</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SpillCostInfo
</span><a href="#local-6989586621681025852"><span class="hs-identifier hs-var">spillCosts</span></a></span><span>
</span><span id="line-163"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raPlatform :: Platform
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raPlatform"><span class="hs-identifier hs-var">raPlatform</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025881"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-164"></span><span>                        </span><span class="hs-special">}</span><span>
</span><span id="line-165"></span><span>                 </span><span class="hs-keyword">else</span><span>   </span><span class="annot"><span class="annottext">Maybe (RegAllocStats statics instr)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-166"></span><span>
</span><span id="line-167"></span><span>        </span><span class="hs-comment">-- Try and color the graph.</span><span>
</span><span id="line-168"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681025823"><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025823"><span class="hs-identifier hs-var">graph_colored</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681025822"><span class="annot"><span class="annottext">UniqSet VirtualReg
</span><a href="#local-6989586621681025822"><span class="hs-identifier hs-var">rsSpill</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681025821"><span class="annot"><span class="annottext">UniqFM VirtualReg VirtualReg
</span><a href="#local-6989586621681025821"><span class="hs-identifier hs-var">rmCoalesce</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-169"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-pragma">{-# SCC</span><span> </span><span class="hs-pragma">&quot;ColorGraph&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-170"></span><span>                  </span><span class="annot"><span class="annottext">Bool
-&gt; Int
-&gt; UniqFM RegClass (UniqSet RealReg)
-&gt; Triv VirtualReg RegClass RealReg
-&gt; (Graph VirtualReg RegClass RealReg -&gt; VirtualReg)
-&gt; Graph VirtualReg RegClass RealReg
-&gt; (Graph VirtualReg RegClass RealReg, UniqSet VirtualReg,
    UniqFM VirtualReg VirtualReg)
forall k cls color.
(Uniquable k, Uniquable cls, Uniquable color, Eq cls, Ord k,
 Outputable k, Outputable cls, Outputable color) =&gt;
Bool
-&gt; Int
-&gt; UniqFM cls (UniqSet color)
-&gt; Triv k cls color
-&gt; (Graph k cls color -&gt; k)
-&gt; Graph k cls color
-&gt; (Graph k cls color, UniqSet k, UniqFM k k)
</span><a href="GHC.Data.Graph.Color.html#colorGraph"><span class="hs-identifier hs-var">Color.colorGraph</span></a></span><span>
</span><span id="line-171"></span><span>                       </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NCGConfig -&gt; Bool
</span><a href="GHC.CmmToAsm.Config.html#ncgRegsIterative"><span class="hs-identifier hs-var hs-var">ncgRegsIterative</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025890"><span class="hs-identifier hs-var">config</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-172"></span><span>                       </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025889"><span class="hs-identifier hs-var">spinCount</span></a></span><span>
</span><span id="line-173"></span><span>                       </span><span class="annot"><span class="annottext">UniqFM RegClass (UniqSet RealReg)
</span><a href="#local-6989586621681025887"><span class="hs-identifier hs-var">regsFree</span></a></span><span> </span><span class="annot"><span class="annottext">Triv VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025888"><span class="hs-identifier hs-var">triv</span></a></span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg -&gt; VirtualReg
</span><a href="#local-6989586621681025847"><span class="hs-identifier hs-var">spill</span></a></span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025858"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span>        </span><span class="hs-comment">-- Rewrite registers in the code that have been coalesced.</span><span>
</span><span id="line-176"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025817"><span class="annot"><span class="annottext">patchF :: Reg -&gt; Reg
</span><a href="#local-6989586621681025817"><span class="hs-identifier hs-var hs-var">patchF</span></a></span></span><span> </span><span id="local-6989586621681025816"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025816"><span class="hs-identifier hs-var">reg</span></a></span></span><span>
</span><span id="line-177"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegVirtual"><span class="hs-identifier hs-type">RegVirtual</span></a></span><span> </span><span id="local-6989586621681025814"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025814"><span class="hs-identifier hs-var">vr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025816"><span class="hs-identifier hs-var">reg</span></a></span><span>
</span><span id="line-178"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg VirtualReg -&gt; VirtualReg -&gt; Maybe VirtualReg
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg VirtualReg
</span><a href="#local-6989586621681025821"><span class="hs-identifier hs-var">rmCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025814"><span class="hs-identifier hs-var">vr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-179"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681025812"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025812"><span class="hs-identifier hs-var">vr'</span></a></span></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Reg -&gt; Reg
</span><a href="#local-6989586621681025817"><span class="hs-identifier hs-var">patchF</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VirtualReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegVirtual"><span class="hs-identifier hs-var">RegVirtual</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025812"><span class="hs-identifier hs-var">vr'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-180"></span><span>                        </span><span class="annot"><span class="annottext">Maybe VirtualReg
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025816"><span class="hs-identifier hs-var">reg</span></a></span><span>
</span><span id="line-181"></span><span>
</span><span id="line-182"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-183"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025816"><span class="hs-identifier hs-var">reg</span></a></span><span>
</span><span id="line-184"></span><span>
</span><span id="line-185"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681025810"><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025810"><span class="hs-identifier hs-var">code_coalesced</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveCmmDecl"><span class="hs-identifier hs-type">LiveCmmDecl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026111"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026112"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-186"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LiveCmmDecl statics instr -&gt; LiveCmmDecl statics instr)
-&gt; [LiveCmmDecl statics instr] -&gt; [LiveCmmDecl statics instr]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Reg -&gt; Reg)
-&gt; LiveCmmDecl statics instr -&gt; LiveCmmDecl statics instr
forall instr statics.
Instruction instr =&gt;
(Reg -&gt; Reg)
-&gt; LiveCmmDecl statics instr -&gt; LiveCmmDecl statics instr
</span><a href="GHC.CmmToAsm.Reg.Liveness.html#patchEraseLive"><span class="hs-identifier hs-var">patchEraseLive</span></a></span><span> </span><span class="annot"><span class="annottext">Reg -&gt; Reg
</span><a href="#local-6989586621681025817"><span class="hs-identifier hs-var">patchF</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025883"><span class="hs-identifier hs-var">code</span></a></span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span>        </span><span class="hs-comment">-- Check whether we've found a coloring.</span><span>
</span><span id="line-189"></span><span>        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">UniqSet VirtualReg -&gt; Bool
forall a. UniqSet a -&gt; Bool
</span><a href="GHC.Types.Unique.Set.html#isEmptyUniqSet"><span class="hs-identifier hs-var">isEmptyUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet VirtualReg
</span><a href="#local-6989586621681025822"><span class="hs-identifier hs-var">rsSpill</span></a></span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span>         </span><span class="hs-comment">-- Coloring was successful because no registers needed to be spilled.</span><span>
</span><span id="line-192"></span><span>         </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-193"></span><span>                </span><span class="hs-comment">-- if -fasm-lint is turned on then validate the graph.</span><span>
</span><span id="line-194"></span><span>                </span><span class="hs-comment">-- This checks for bugs in the graph allocator itself.</span><span>
</span><span id="line-195"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025803"><span class="annot"><span class="annottext">graph_colored_lint :: Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025803"><span class="hs-identifier hs-var hs-var">graph_colored_lint</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span>
</span><span id="line-196"></span><span>                        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Bool
</span><a href="GHC.CmmToAsm.Config.html#ncgAsmLinting"><span class="hs-identifier hs-var hs-var">ncgAsmLinting</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025890"><span class="hs-identifier hs-var">config</span></a></span><span>
</span><span id="line-197"></span><span>                                </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">SDoc
-&gt; Bool
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
forall k color cls.
(Uniquable k, Outputable k, Eq color) =&gt;
SDoc -&gt; Bool -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#validateGraph"><span class="hs-identifier hs-var">Color.validateGraph</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-198"></span><span>                                        </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>    </span><span class="hs-comment">-- Require all nodes to be colored.</span><span>
</span><span id="line-199"></span><span>                                        </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025823"><span class="hs-identifier hs-var">graph_colored</span></a></span><span>
</span><span id="line-200"></span><span>                                </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025823"><span class="hs-identifier hs-var">graph_colored</span></a></span><span>
</span><span id="line-201"></span><span>
</span><span id="line-202"></span><span>                </span><span class="hs-comment">-- Rewrite the code to use real hregs, using the colored graph.</span><span>
</span><span id="line-203"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025797"><span class="annot"><span class="annottext">code_patched :: [LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025797"><span class="hs-identifier hs-var hs-var">code_patched</span></a></span></span><span>
</span><span id="line-204"></span><span>                        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LiveCmmDecl statics instr -&gt; LiveCmmDecl statics instr)
-&gt; [LiveCmmDecl statics instr] -&gt; [LiveCmmDecl statics instr]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform
-&gt; Graph VirtualReg RegClass RealReg
-&gt; LiveCmmDecl statics instr
-&gt; LiveCmmDecl statics instr
forall statics instr.
(Outputable statics, Outputable instr, Instruction instr) =&gt;
Platform
-&gt; Graph VirtualReg RegClass RealReg
-&gt; LiveCmmDecl statics instr
-&gt; LiveCmmDecl statics instr
</span><a href="GHC.CmmToAsm.Reg.Graph.html#patchRegsFromGraph"><span class="hs-identifier hs-var">patchRegsFromGraph</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025881"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025803"><span class="hs-identifier hs-var">graph_colored_lint</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-205"></span><span>                              </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025810"><span class="hs-identifier hs-var">code_coalesced</span></a></span><span>
</span><span id="line-206"></span><span>
</span><span id="line-207"></span><span>                </span><span class="hs-comment">-- Clean out unneeded SPILL/RELOAD meta instructions.</span><span>
</span><span id="line-208"></span><span>                </span><span class="hs-comment">--   The spill code generator just spills the entire live range</span><span>
</span><span id="line-209"></span><span>                </span><span class="hs-comment">--   of a vreg, but it might not need to be on the stack for</span><span>
</span><span id="line-210"></span><span>                </span><span class="hs-comment">--   its entire lifetime.</span><span>
</span><span id="line-211"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025794"><span class="annot"><span class="annottext">code_spillclean :: [LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025794"><span class="hs-identifier hs-var hs-var">code_spillclean</span></a></span></span><span>
</span><span id="line-212"></span><span>                        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LiveCmmDecl statics instr -&gt; LiveCmmDecl statics instr)
-&gt; [LiveCmmDecl statics instr] -&gt; [LiveCmmDecl statics instr]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; LiveCmmDecl statics instr -&gt; LiveCmmDecl statics instr
forall instr statics.
Instruction instr =&gt;
Platform -&gt; LiveCmmDecl statics instr -&gt; LiveCmmDecl statics instr
</span><a href="GHC.CmmToAsm.Reg.Graph.SpillClean.html#cleanSpills"><span class="hs-identifier hs-var">cleanSpills</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025881"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025797"><span class="hs-identifier hs-var">code_patched</span></a></span><span>
</span><span id="line-213"></span><span>
</span><span id="line-214"></span><span>                </span><span class="hs-comment">-- Strip off liveness information from the allocated code.</span><span>
</span><span id="line-215"></span><span>                </span><span class="hs-comment">-- Also rewrite SPILL/RELOAD meta instructions into real machine</span><span>
</span><span id="line-216"></span><span>                </span><span class="hs-comment">-- instructions along the way</span><span>
</span><span id="line-217"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025789"><span class="annot"><span class="annottext">code_final :: [NatCmmDecl statics instr]
</span><a href="#local-6989586621681025789"><span class="hs-identifier hs-var hs-var">code_final</span></a></span></span><span>
</span><span id="line-218"></span><span>                        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LiveCmmDecl statics instr -&gt; NatCmmDecl statics instr)
-&gt; [LiveCmmDecl statics instr] -&gt; [NatCmmDecl statics instr]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NCGConfig -&gt; LiveCmmDecl statics instr -&gt; NatCmmDecl statics instr
forall statics instr.
(Outputable statics, Outputable instr, Instruction instr) =&gt;
NCGConfig -&gt; LiveCmmDecl statics instr -&gt; NatCmmDecl statics instr
</span><a href="GHC.CmmToAsm.Reg.Liveness.html#stripLive"><span class="hs-identifier hs-var">stripLive</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025890"><span class="hs-identifier hs-var">config</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025794"><span class="hs-identifier hs-var">code_spillclean</span></a></span><span>
</span><span id="line-219"></span><span>
</span><span id="line-220"></span><span>                </span><span class="hs-comment">-- Record what happened in this stage for debugging</span><span>
</span><span id="line-221"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025785"><span class="annot"><span class="annottext">stat :: RegAllocStats statics instr
</span><a href="#local-6989586621681025785"><span class="hs-identifier hs-var hs-var">stat</span></a></span></span><span>
</span><span id="line-222"></span><span>                     </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">RegAllocStatsColored :: forall statics instr.
[LiveCmmDecl statics instr]
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
-&gt; UniqFM VirtualReg VirtualReg
-&gt; [LiveCmmDecl statics instr]
-&gt; [LiveCmmDecl statics instr]
-&gt; [LiveCmmDecl statics instr]
-&gt; [NatCmmDecl statics instr]
-&gt; (Int, Int, Int)
-&gt; Platform
-&gt; RegAllocStats statics instr
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#RegAllocStatsColored"><span class="hs-identifier hs-type">RegAllocStatsColored</span></a></span><span>
</span><span id="line-223"></span><span>                        </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">raCode :: [LiveCmmDecl statics instr]
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raCode"><span class="hs-identifier hs-var">raCode</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025883"><span class="hs-identifier hs-var">code</span></a></span><span>
</span><span id="line-224"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raGraph :: Graph VirtualReg RegClass RealReg
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raGraph"><span class="hs-identifier hs-var">raGraph</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025858"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-225"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raGraphColored :: Graph VirtualReg RegClass RealReg
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raGraphColored"><span class="hs-identifier hs-var">raGraphColored</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025803"><span class="hs-identifier hs-var">graph_colored_lint</span></a></span><span>
</span><span id="line-226"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raCoalesced :: UniqFM VirtualReg VirtualReg
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raCoalesced"><span class="hs-identifier hs-var">raCoalesced</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg VirtualReg
</span><a href="#local-6989586621681025821"><span class="hs-identifier hs-var">rmCoalesce</span></a></span><span>
</span><span id="line-227"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raCodeCoalesced :: [LiveCmmDecl statics instr]
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raCodeCoalesced"><span class="hs-identifier hs-var">raCodeCoalesced</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025810"><span class="hs-identifier hs-var">code_coalesced</span></a></span><span>
</span><span id="line-228"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raPatched :: [LiveCmmDecl statics instr]
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raPatched"><span class="hs-identifier hs-var">raPatched</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025797"><span class="hs-identifier hs-var">code_patched</span></a></span><span>
</span><span id="line-229"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raSpillClean :: [LiveCmmDecl statics instr]
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raSpillClean"><span class="hs-identifier hs-var">raSpillClean</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025794"><span class="hs-identifier hs-var">code_spillclean</span></a></span><span>
</span><span id="line-230"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raFinal :: [NatCmmDecl statics instr]
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raFinal"><span class="hs-identifier hs-var">raFinal</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[NatCmmDecl statics instr]
</span><a href="#local-6989586621681025789"><span class="hs-identifier hs-var">code_final</span></a></span><span>
</span><span id="line-231"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raSRMs :: (Int, Int, Int)
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raSRMs"><span class="hs-identifier hs-var">raSRMs</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Int, Int, Int) -&gt; (Int, Int, Int) -&gt; (Int, Int, Int))
-&gt; (Int, Int, Int) -&gt; [(Int, Int, Int)] -&gt; (Int, Int, Int)
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">(Int, Int, Int) -&gt; (Int, Int, Int) -&gt; (Int, Int, Int)
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#addSRM"><span class="hs-identifier hs-var">addSRM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span>
</span><span id="line-232"></span><span>                                                </span><span class="annot"><span class="annottext">([(Int, Int, Int)] -&gt; (Int, Int, Int))
-&gt; [(Int, Int, Int)] -&gt; (Int, Int, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(LiveCmmDecl statics instr -&gt; (Int, Int, Int))
-&gt; [LiveCmmDecl statics instr] -&gt; [(Int, Int, Int)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LiveCmmDecl statics instr -&gt; (Int, Int, Int)
forall instr statics.
Instruction instr =&gt;
LiveCmmDecl statics instr -&gt; (Int, Int, Int)
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#countSRMs"><span class="hs-identifier hs-var">countSRMs</span></a></span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025794"><span class="hs-identifier hs-var">code_spillclean</span></a></span><span>
</span><span id="line-233"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raPlatform :: Platform
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raPlatform"><span class="hs-identifier hs-var">raPlatform</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025881"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-234"></span><span>                     </span><span class="hs-special">}</span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span>                </span><span class="hs-comment">-- Bundle up all the register allocator statistics.</span><span>
</span><span id="line-237"></span><span>                </span><span class="hs-comment">--   .. but make sure to drop them on the floor if they're not</span><span>
</span><span id="line-238"></span><span>                </span><span class="hs-comment">--      needed, otherwise we'll get a space leak.</span><span>
</span><span id="line-239"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025773"><span class="annot"><span class="annottext">statList :: [RegAllocStats statics instr]
</span><a href="#local-6989586621681025773"><span class="hs-identifier hs-var hs-var">statList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-240"></span><span>                        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681025878"><span class="hs-identifier hs-var">dump</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RegAllocStats statics instr
</span><a href="#local-6989586621681025785"><span class="hs-identifier hs-var">stat</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[RegAllocStats statics instr]
-&gt; [RegAllocStats statics instr] -&gt; [RegAllocStats statics instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (RegAllocStats statics instr)
-&gt; [RegAllocStats statics instr]
forall a. Maybe a -&gt; [a]
</span><a href="../../base/src/Data.Maybe.html#maybeToList"><span class="hs-identifier hs-var">maybeToList</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (RegAllocStats statics instr)
</span><a href="#local-6989586621681025843"><span class="hs-identifier hs-var">stat1</span></a></span><span> </span><span class="annot"><span class="annottext">[RegAllocStats statics instr]
-&gt; [RegAllocStats statics instr] -&gt; [RegAllocStats statics instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[RegAllocStats statics instr]
</span><a href="#local-6989586621681025884"><span class="hs-identifier hs-var">debug_codeGraphs</span></a></span><span>
</span><span id="line-241"></span><span>                                </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-242"></span><span>
</span><span id="line-243"></span><span>                </span><span class="hs-comment">-- Ensure all the statistics are evaluated, to avoid space leaks.</span><span>
</span><span id="line-244"></span><span>                </span><span class="annot"><span class="annottext">[RegAllocStats statics instr] -&gt; UniqSM () -&gt; UniqSM ()
forall a b. [a] -&gt; b -&gt; b
</span><a href="GHC.Utils.Misc.html#seqList"><span class="hs-identifier hs-var">seqList</span></a></span><span> </span><span class="annot"><span class="annottext">[RegAllocStats statics instr]
</span><a href="#local-6989586621681025773"><span class="hs-identifier hs-var">statList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">() -&gt; UniqSM ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-245"></span><span>
</span><span id="line-246"></span><span>                </span><span class="annot"><span class="annottext">([NatCmmDecl statics instr], [RegAllocStats statics instr], Int,
 Graph VirtualReg RegClass RealReg)
-&gt; UniqSM
     ([NatCmmDecl statics instr], [RegAllocStats statics instr], Int,
      Graph VirtualReg RegClass RealReg)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">[NatCmmDecl statics instr]
</span><a href="#local-6989586621681025789"><span class="hs-identifier hs-var">code_final</span></a></span><span>
</span><span id="line-247"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[RegAllocStats statics instr]
</span><a href="#local-6989586621681025773"><span class="hs-identifier hs-var">statList</span></a></span><span>
</span><span id="line-248"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025885"><span class="hs-identifier hs-var">slotsCount</span></a></span><span>
</span><span id="line-249"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025803"><span class="hs-identifier hs-var">graph_colored_lint</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-250"></span><span>
</span><span id="line-251"></span><span>         </span><span class="hs-comment">-- Coloring was unsuccessful. We need to spill some register to the</span><span>
</span><span id="line-252"></span><span>         </span><span class="hs-comment">-- stack, make a new graph, and try to color it again.</span><span>
</span><span id="line-253"></span><span>         </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-254"></span><span>                </span><span class="hs-comment">-- if -fasm-lint is turned on then validate the graph</span><span>
</span><span id="line-255"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025768"><span class="annot"><span class="annottext">graph_colored_lint :: Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025768"><span class="hs-identifier hs-var hs-var">graph_colored_lint</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span>
</span><span id="line-256"></span><span>                        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">NCGConfig -&gt; Bool
</span><a href="GHC.CmmToAsm.Config.html#ncgAsmLinting"><span class="hs-identifier hs-var hs-var">ncgAsmLinting</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025890"><span class="hs-identifier hs-var">config</span></a></span><span>
</span><span id="line-257"></span><span>                                </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">SDoc
-&gt; Bool
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
forall k color cls.
(Uniquable k, Outputable k, Eq color) =&gt;
SDoc -&gt; Bool -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#validateGraph"><span class="hs-identifier hs-var">Color.validateGraph</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-258"></span><span>                                        </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>   </span><span class="hs-comment">-- don't require nodes to be colored</span><span>
</span><span id="line-259"></span><span>                                        </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025823"><span class="hs-identifier hs-var">graph_colored</span></a></span><span>
</span><span id="line-260"></span><span>                                </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025823"><span class="hs-identifier hs-var">graph_colored</span></a></span><span>
</span><span id="line-261"></span><span>
</span><span id="line-262"></span><span>                </span><span class="hs-comment">-- Spill uncolored regs to the stack.</span><span>
</span><span id="line-263"></span><span>                </span><span class="hs-special">(</span><span id="local-6989586621681025767"><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025767"><span class="hs-identifier hs-var">code_spilled</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681025766"><span class="annot"><span class="annottext">UniqSet Int
</span><a href="#local-6989586621681025766"><span class="hs-identifier hs-var">slotsFree'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681025765"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025765"><span class="hs-identifier hs-var">slotsCount'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681025764"><span class="annot"><span class="annottext">SpillStats
</span><a href="#local-6989586621681025764"><span class="hs-identifier hs-var">spillStats</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-264"></span><span>                        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Platform
-&gt; [LiveCmmDecl statics instr]
-&gt; UniqSet Int
-&gt; Int
-&gt; UniqSet VirtualReg
-&gt; UniqSM
     ([LiveCmmDecl statics instr], UniqSet Int, Int, SpillStats)
forall instr statics.
Instruction instr =&gt;
Platform
-&gt; [LiveCmmDecl statics instr]
-&gt; UniqSet Int
-&gt; Int
-&gt; UniqSet VirtualReg
-&gt; UniqSM
     ([LiveCmmDecl statics instr], UniqSet Int, Int, SpillStats)
</span><a href="GHC.CmmToAsm.Reg.Graph.Spill.html#regSpill"><span class="hs-identifier hs-var">regSpill</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025881"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025810"><span class="hs-identifier hs-var">code_coalesced</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet Int
</span><a href="#local-6989586621681025886"><span class="hs-identifier hs-var">slotsFree</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025885"><span class="hs-identifier hs-var">slotsCount</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet VirtualReg
</span><a href="#local-6989586621681025822"><span class="hs-identifier hs-var">rsSpill</span></a></span><span>
</span><span id="line-265"></span><span>
</span><span id="line-266"></span><span>                </span><span class="hs-comment">-- Recalculate liveness information.</span><span>
</span><span id="line-267"></span><span>                </span><span class="hs-comment">-- NOTE: we have to reverse the SCCs here to get them back into</span><span>
</span><span id="line-268"></span><span>                </span><span class="hs-comment">--       the reverse-dependency order required by computeLiveness.</span><span>
</span><span id="line-269"></span><span>                </span><span class="hs-comment">--       If they're not in the correct order that function will panic.</span><span>
</span><span id="line-270"></span><span>                </span><span id="local-6989586621681025762"><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025762"><span class="hs-identifier hs-var">code_relive</span></a></span></span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LiveCmmDecl statics instr -&gt; UniqSM (LiveCmmDecl statics instr))
-&gt; [LiveCmmDecl statics instr]
-&gt; UniqSM [LiveCmmDecl statics instr]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform
-&gt; LiveCmmDecl statics instr -&gt; UniqSM (LiveCmmDecl statics instr)
forall instr statics.
(Outputable instr, Instruction instr) =&gt;
Platform
-&gt; LiveCmmDecl statics instr -&gt; UniqSM (LiveCmmDecl statics instr)
</span><a href="GHC.CmmToAsm.Reg.Liveness.html#regLiveness"><span class="hs-identifier hs-var">regLiveness</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025881"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">(LiveCmmDecl statics instr -&gt; UniqSM (LiveCmmDecl statics instr))
-&gt; (LiveCmmDecl statics instr -&gt; LiveCmmDecl statics instr)
-&gt; LiveCmmDecl statics instr
-&gt; UniqSM (LiveCmmDecl statics instr)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LiveCmmDecl statics instr -&gt; LiveCmmDecl statics instr
forall statics instr.
LiveCmmDecl statics instr -&gt; LiveCmmDecl statics instr
</span><a href="GHC.CmmToAsm.Reg.Liveness.html#reverseBlocksInTops"><span class="hs-identifier hs-var">reverseBlocksInTops</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-271"></span><span>                                        </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025767"><span class="hs-identifier hs-var">code_spilled</span></a></span><span>
</span><span id="line-272"></span><span>
</span><span id="line-273"></span><span>                </span><span class="hs-comment">-- Record what happened in this stage for debugging.</span><span>
</span><span id="line-274"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025757"><span class="annot"><span class="annottext">stat :: RegAllocStats statics instr
</span><a href="#local-6989586621681025757"><span class="hs-identifier hs-var hs-var">stat</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span>
</span><span id="line-275"></span><span>                        </span><span class="annot"><span class="annottext">RegAllocStatsSpill :: forall statics instr.
[LiveCmmDecl statics instr]
-&gt; Graph VirtualReg RegClass RealReg
-&gt; UniqFM VirtualReg VirtualReg
-&gt; SpillStats
-&gt; SpillCostInfo
-&gt; [LiveCmmDecl statics instr]
-&gt; Platform
-&gt; RegAllocStats statics instr
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#RegAllocStatsSpill"><span class="hs-identifier hs-type">RegAllocStatsSpill</span></a></span><span>
</span><span id="line-276"></span><span>                        </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">raCode :: [LiveCmmDecl statics instr]
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raCode"><span class="hs-identifier hs-var">raCode</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025883"><span class="hs-identifier hs-var">code</span></a></span><span>
</span><span id="line-277"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raGraph :: Graph VirtualReg RegClass RealReg
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raGraph"><span class="hs-identifier hs-var">raGraph</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025768"><span class="hs-identifier hs-var">graph_colored_lint</span></a></span><span>
</span><span id="line-278"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raCoalesced :: UniqFM VirtualReg VirtualReg
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raCoalesced"><span class="hs-identifier hs-var">raCoalesced</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg VirtualReg
</span><a href="#local-6989586621681025821"><span class="hs-identifier hs-var">rmCoalesce</span></a></span><span>
</span><span id="line-279"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raSpillStats :: SpillStats
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raSpillStats"><span class="hs-identifier hs-var">raSpillStats</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SpillStats
</span><a href="#local-6989586621681025764"><span class="hs-identifier hs-var">spillStats</span></a></span><span>
</span><span id="line-280"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raSpillCosts :: SpillCostInfo
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raSpillCosts"><span class="hs-identifier hs-var">raSpillCosts</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SpillCostInfo
</span><a href="#local-6989586621681025852"><span class="hs-identifier hs-var">spillCosts</span></a></span><span>
</span><span id="line-281"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raSpilled :: [LiveCmmDecl statics instr]
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raSpilled"><span class="hs-identifier hs-var">raSpilled</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025767"><span class="hs-identifier hs-var">code_spilled</span></a></span><span>
</span><span id="line-282"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">raPlatform :: Platform
</span><a href="GHC.CmmToAsm.Reg.Graph.Stats.html#raPlatform"><span class="hs-identifier hs-var">raPlatform</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025881"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-283"></span><span>
</span><span id="line-284"></span><span>                </span><span class="hs-comment">-- Bundle up all the register allocator statistics.</span><span>
</span><span id="line-285"></span><span>                </span><span class="hs-comment">--   .. but make sure to drop them on the floor if they're not</span><span>
</span><span id="line-286"></span><span>                </span><span class="hs-comment">--      needed, otherwise we'll get a space leak.</span><span>
</span><span id="line-287"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025753"><span class="annot"><span class="annottext">statList :: [RegAllocStats statics instr]
</span><a href="#local-6989586621681025753"><span class="hs-identifier hs-var hs-var">statList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-288"></span><span>                        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681025878"><span class="hs-identifier hs-var">dump</span></a></span><span>
</span><span id="line-289"></span><span>                                </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RegAllocStats statics instr
</span><a href="#local-6989586621681025757"><span class="hs-identifier hs-var">stat</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[RegAllocStats statics instr]
-&gt; [RegAllocStats statics instr] -&gt; [RegAllocStats statics instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (RegAllocStats statics instr)
-&gt; [RegAllocStats statics instr]
forall a. Maybe a -&gt; [a]
</span><a href="../../base/src/Data.Maybe.html#maybeToList"><span class="hs-identifier hs-var">maybeToList</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (RegAllocStats statics instr)
</span><a href="#local-6989586621681025843"><span class="hs-identifier hs-var">stat1</span></a></span><span> </span><span class="annot"><span class="annottext">[RegAllocStats statics instr]
-&gt; [RegAllocStats statics instr] -&gt; [RegAllocStats statics instr]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[RegAllocStats statics instr]
</span><a href="#local-6989586621681025884"><span class="hs-identifier hs-var">debug_codeGraphs</span></a></span><span>
</span><span id="line-290"></span><span>                                </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-291"></span><span>
</span><span id="line-292"></span><span>                </span><span class="hs-comment">-- Ensure all the statistics are evaluated, to avoid space leaks.</span><span>
</span><span id="line-293"></span><span>                </span><span class="annot"><span class="annottext">[RegAllocStats statics instr] -&gt; UniqSM () -&gt; UniqSM ()
forall a b. [a] -&gt; b -&gt; b
</span><a href="GHC.Utils.Misc.html#seqList"><span class="hs-identifier hs-var">seqList</span></a></span><span> </span><span class="annot"><span class="annottext">[RegAllocStats statics instr]
</span><a href="#local-6989586621681025753"><span class="hs-identifier hs-var">statList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">() -&gt; UniqSM ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-294"></span><span>
</span><span id="line-295"></span><span>                </span><span class="annot"><span class="annottext">NCGConfig
-&gt; Int
-&gt; Triv VirtualReg RegClass RealReg
-&gt; UniqFM RegClass (UniqSet RealReg)
-&gt; UniqSet Int
-&gt; Int
-&gt; [RegAllocStats statics instr]
-&gt; [LiveCmmDecl statics instr]
-&gt; Maybe CFG
-&gt; UniqSM
     ([NatCmmDecl statics instr], [RegAllocStats statics instr], Int,
      Graph VirtualReg RegClass RealReg)
forall instr statics.
(Instruction instr, Outputable instr, Outputable statics) =&gt;
NCGConfig
-&gt; Int
-&gt; Triv VirtualReg RegClass RealReg
-&gt; UniqFM RegClass (UniqSet RealReg)
-&gt; UniqSet Int
-&gt; Int
-&gt; [RegAllocStats statics instr]
-&gt; [LiveCmmDecl statics instr]
-&gt; Maybe CFG
-&gt; UniqSM
     ([NatCmmDecl statics instr], [RegAllocStats statics instr], Int,
      Graph VirtualReg RegClass RealReg)
</span><a href="GHC.CmmToAsm.Reg.Graph.html#regAlloc_spin"><span class="hs-identifier hs-var">regAlloc_spin</span></a></span><span> </span><span class="annot"><span class="annottext">NCGConfig
</span><a href="#local-6989586621681025890"><span class="hs-identifier hs-var">config</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025889"><span class="hs-identifier hs-var">spinCount</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Triv VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025888"><span class="hs-identifier hs-var">triv</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM RegClass (UniqSet RealReg)
</span><a href="#local-6989586621681025887"><span class="hs-identifier hs-var">regsFree</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet Int
</span><a href="#local-6989586621681025766"><span class="hs-identifier hs-var">slotsFree'</span></a></span><span>
</span><span id="line-296"></span><span>                              </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681025765"><span class="hs-identifier hs-var">slotsCount'</span></a></span><span> </span><span class="annot"><span class="annottext">[RegAllocStats statics instr]
</span><a href="#local-6989586621681025753"><span class="hs-identifier hs-var">statList</span></a></span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025762"><span class="hs-identifier hs-var">code_relive</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe CFG
</span><a href="#local-6989586621681025882"><span class="hs-identifier hs-var">cfg</span></a></span><span>
</span><span id="line-297"></span><span>
</span><span id="line-298"></span><span>
</span><span id="line-299"></span><span class="hs-comment">-- | Build a graph from the liveness and coalesce information in this code.</span><span>
</span><span id="line-300"></span><span id="local-6989586621681026085"><span id="local-6989586621681026086"><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#buildGraph"><span class="hs-identifier hs-type">buildGraph</span></a></span><span>
</span><span id="line-301"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026086"><span class="hs-identifier hs-type">instr</span></a></span><span>
</span><span id="line-302"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveCmmDecl"><span class="hs-identifier hs-type">LiveCmmDecl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026085"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026086"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-303"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html#UniqSM"><span class="hs-identifier hs-type">UniqSM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Color.Graph</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-304"></span><span>
</span><span id="line-305"></span><span id="buildGraph"><span class="annot"><span class="annottext">buildGraph :: forall instr statics.
Instruction instr =&gt;
[LiveCmmDecl statics instr]
-&gt; UniqSM (Graph VirtualReg RegClass RealReg)
</span><a href="GHC.CmmToAsm.Reg.Graph.html#buildGraph"><span class="hs-identifier hs-var hs-var">buildGraph</span></a></span></span><span> </span><span id="local-6989586621681025749"><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025749"><span class="hs-identifier hs-var">code</span></a></span></span><span>
</span><span id="line-306"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-307"></span><span>        </span><span class="hs-comment">-- Slurp out the conflicts and reg-&gt;reg moves from this code.</span><span>
</span><span id="line-308"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681025747"><span class="annot"><span class="annottext">[Bag (UniqSet Reg)]
</span><a href="#local-6989586621681025747"><span class="hs-identifier hs-var">conflictList</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681025746"><span class="annot"><span class="annottext">[Bag (Reg, Reg)]
</span><a href="#local-6989586621681025746"><span class="hs-identifier hs-var">moveList</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-309"></span><span>                </span><span class="annot"><span class="annottext">[(Bag (UniqSet Reg), Bag (Reg, Reg))]
-&gt; ([Bag (UniqSet Reg)], [Bag (Reg, Reg)])
forall a b. [(a, b)] -&gt; ([a], [b])
</span><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier hs-var">unzip</span></a></span><span> </span><span class="annot"><span class="annottext">([(Bag (UniqSet Reg), Bag (Reg, Reg))]
 -&gt; ([Bag (UniqSet Reg)], [Bag (Reg, Reg)]))
-&gt; [(Bag (UniqSet Reg), Bag (Reg, Reg))]
-&gt; ([Bag (UniqSet Reg)], [Bag (Reg, Reg)])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(LiveCmmDecl statics instr -&gt; (Bag (UniqSet Reg), Bag (Reg, Reg)))
-&gt; [LiveCmmDecl statics instr]
-&gt; [(Bag (UniqSet Reg), Bag (Reg, Reg))]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LiveCmmDecl statics instr -&gt; (Bag (UniqSet Reg), Bag (Reg, Reg))
forall instr statics.
Instruction instr =&gt;
LiveCmmDecl statics instr -&gt; (Bag (UniqSet Reg), Bag (Reg, Reg))
</span><a href="GHC.CmmToAsm.Reg.Liveness.html#slurpConflicts"><span class="hs-identifier hs-var">slurpConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025749"><span class="hs-identifier hs-var">code</span></a></span><span>
</span><span id="line-310"></span><span>
</span><span id="line-311"></span><span>        </span><span class="hs-comment">-- Slurp out the spill/reload coalesces.</span><span>
</span><span id="line-312"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025742"><span class="annot"><span class="annottext">moveList2 :: [Bag (Reg, Reg)]
</span><a href="#local-6989586621681025742"><span class="hs-identifier hs-var hs-var">moveList2</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LiveCmmDecl statics instr -&gt; Bag (Reg, Reg))
-&gt; [LiveCmmDecl statics instr] -&gt; [Bag (Reg, Reg)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LiveCmmDecl statics instr -&gt; Bag (Reg, Reg)
forall statics instr.
Instruction instr =&gt;
LiveCmmDecl statics instr -&gt; Bag (Reg, Reg)
</span><a href="GHC.CmmToAsm.Reg.Liveness.html#slurpReloadCoalesce"><span class="hs-identifier hs-var">slurpReloadCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">[LiveCmmDecl statics instr]
</span><a href="#local-6989586621681025749"><span class="hs-identifier hs-var">code</span></a></span><span>
</span><span id="line-313"></span><span>
</span><span id="line-314"></span><span>        </span><span class="hs-comment">-- Add the reg-reg conflicts to the graph.</span><span>
</span><span id="line-315"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025740"><span class="annot"><span class="annottext">conflictBag :: Bag (UniqSet Reg)
</span><a href="#local-6989586621681025740"><span class="hs-identifier hs-var hs-var">conflictBag</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Bag (UniqSet Reg)] -&gt; Bag (UniqSet Reg)
forall a. [Bag a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionManyBags"><span class="hs-identifier hs-var">unionManyBags</span></a></span><span> </span><span class="annot"><span class="annottext">[Bag (UniqSet Reg)]
</span><a href="#local-6989586621681025747"><span class="hs-identifier hs-var">conflictList</span></a></span><span>
</span><span id="line-316"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025736"><span class="annot"><span class="annottext">graph_conflict :: Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025736"><span class="hs-identifier hs-var hs-var">graph_conflict</span></a></span></span><span>
</span><span id="line-317"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(UniqSet Reg
 -&gt; Graph VirtualReg RegClass RealReg
 -&gt; Graph VirtualReg RegClass RealReg)
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Bag (UniqSet Reg)
-&gt; Graph VirtualReg RegClass RealReg
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet Reg
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
</span><a href="GHC.CmmToAsm.Reg.Graph.html#graphAddConflictSet"><span class="hs-identifier hs-var">graphAddConflictSet</span></a></span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
forall k cls color. Graph k cls color
</span><a href="GHC.Data.Graph.Base.html#initGraph"><span class="hs-identifier hs-var">Color.initGraph</span></a></span><span> </span><span class="annot"><span class="annottext">Bag (UniqSet Reg)
</span><a href="#local-6989586621681025740"><span class="hs-identifier hs-var">conflictBag</span></a></span><span>
</span><span id="line-318"></span><span>
</span><span id="line-319"></span><span>        </span><span class="hs-comment">-- Add the coalescences edges to the graph.</span><span>
</span><span id="line-320"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025732"><span class="annot"><span class="annottext">moveBag :: Bag (Reg, Reg)
</span><a href="#local-6989586621681025732"><span class="hs-identifier hs-var hs-var">moveBag</span></a></span></span><span>
</span><span id="line-321"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag (Reg, Reg) -&gt; Bag (Reg, Reg) -&gt; Bag (Reg, Reg)
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Bag (Reg, Reg)] -&gt; Bag (Reg, Reg)
forall a. [Bag a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionManyBags"><span class="hs-identifier hs-var">unionManyBags</span></a></span><span> </span><span class="annot"><span class="annottext">[Bag (Reg, Reg)]
</span><a href="#local-6989586621681025742"><span class="hs-identifier hs-var">moveList2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-322"></span><span>                            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Bag (Reg, Reg)] -&gt; Bag (Reg, Reg)
forall a. [Bag a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionManyBags"><span class="hs-identifier hs-var">unionManyBags</span></a></span><span> </span><span class="annot"><span class="annottext">[Bag (Reg, Reg)]
</span><a href="#local-6989586621681025746"><span class="hs-identifier hs-var">moveList</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-323"></span><span>
</span><span id="line-324"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681025729"><span class="annot"><span class="annottext">graph_coalesce :: Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025729"><span class="hs-identifier hs-var hs-var">graph_coalesce</span></a></span></span><span>
</span><span id="line-325"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Reg, Reg)
 -&gt; Graph VirtualReg RegClass RealReg
 -&gt; Graph VirtualReg RegClass RealReg)
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Bag (Reg, Reg)
-&gt; Graph VirtualReg RegClass RealReg
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">(Reg, Reg)
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
</span><a href="GHC.CmmToAsm.Reg.Graph.html#graphAddCoalesce"><span class="hs-identifier hs-var">graphAddCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025736"><span class="hs-identifier hs-var">graph_conflict</span></a></span><span> </span><span class="annot"><span class="annottext">Bag (Reg, Reg)
</span><a href="#local-6989586621681025732"><span class="hs-identifier hs-var">moveBag</span></a></span><span>
</span><span id="line-326"></span><span>
</span><span id="line-327"></span><span>        </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
-&gt; UniqSM (Graph VirtualReg RegClass RealReg)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>  </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025729"><span class="hs-identifier hs-var">graph_coalesce</span></a></span><span>
</span><span id="line-328"></span><span>
</span><span id="line-329"></span><span>
</span><span id="line-330"></span><span class="hs-comment">-- | Add some conflict edges to the graph.</span><span>
</span><span id="line-331"></span><span class="hs-comment">--   Conflicts between virtual and real regs are recorded as exclusions.</span><span>
</span><span id="line-332"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#graphAddConflictSet"><span class="hs-identifier hs-type">graphAddConflictSet</span></a></span><span>
</span><span id="line-333"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html#UniqSet"><span class="hs-identifier hs-type">UniqSet</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span>
</span><span id="line-334"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Color.Graph</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span>
</span><span id="line-335"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Color.Graph</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span>
</span><span id="line-336"></span><span>
</span><span id="line-337"></span><span id="graphAddConflictSet"><span class="annot"><span class="annottext">graphAddConflictSet :: UniqSet Reg
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
</span><a href="GHC.CmmToAsm.Reg.Graph.html#graphAddConflictSet"><span class="hs-identifier hs-var hs-var">graphAddConflictSet</span></a></span></span><span> </span><span id="local-6989586621681025727"><span class="annot"><span class="annottext">UniqSet Reg
</span><a href="#local-6989586621681025727"><span class="hs-identifier hs-var">set</span></a></span></span><span> </span><span id="local-6989586621681025726"><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025726"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-338"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>  </span><span id="local-6989586621681025724"><span class="annot"><span class="annottext">virtuals :: UniqSet VirtualReg
</span><a href="#local-6989586621681025724"><span class="hs-identifier hs-var hs-var">virtuals</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[VirtualReg] -&gt; UniqSet VirtualReg
forall a. Uniquable a =&gt; [a] -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#mkUniqSet"><span class="hs-identifier hs-var">mkUniqSet</span></a></span><span>
</span><span id="line-339"></span><span>                        </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025722"><span class="hs-identifier hs-var">vr</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegVirtual"><span class="hs-identifier hs-type">RegVirtual</span></a></span><span> </span><span id="local-6989586621681025722"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025722"><span class="hs-identifier hs-var">vr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UniqSet Reg -&gt; [Reg]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet Reg
</span><a href="#local-6989586621681025727"><span class="hs-identifier hs-var">set</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-340"></span><span>
</span><span id="line-341"></span><span>        </span><span id="local-6989586621681025720"><span class="annot"><span class="annottext">graph1 :: Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025720"><span class="hs-identifier hs-var hs-var">graph1</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet VirtualReg
-&gt; (VirtualReg -&gt; RegClass)
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
forall k cls color.
Uniquable k =&gt;
UniqSet k -&gt; (k -&gt; cls) -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addConflicts"><span class="hs-identifier hs-var">Color.addConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet VirtualReg
</span><a href="#local-6989586621681025724"><span class="hs-identifier hs-var">virtuals</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; RegClass
</span><a href="GHC.Platform.Reg.html#classOfVirtualReg"><span class="hs-identifier hs-var">classOfVirtualReg</span></a></span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025726"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-342"></span><span>
</span><span id="line-343"></span><span>        </span><span id="local-6989586621681025714"><span class="annot"><span class="annottext">graph2 :: Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025714"><span class="hs-identifier hs-var hs-var">graph2</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((VirtualReg, RealReg)
 -&gt; Graph VirtualReg RegClass RealReg
 -&gt; Graph VirtualReg RegClass RealReg)
-&gt; Graph VirtualReg RegClass RealReg
-&gt; [(VirtualReg, RealReg)]
-&gt; Graph VirtualReg RegClass RealReg
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621681025713"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025713"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681025712"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025712"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">VirtualReg
-&gt; (VirtualReg -&gt; RegClass)
-&gt; RealReg
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
forall k color cls.
(Uniquable k, Uniquable color) =&gt;
k -&gt; (k -&gt; cls) -&gt; color -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addExclusion"><span class="hs-identifier hs-var">Color.addExclusion</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025713"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; RegClass
</span><a href="GHC.Platform.Reg.html#classOfVirtualReg"><span class="hs-identifier hs-var">classOfVirtualReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025712"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-344"></span><span>                        </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025720"><span class="hs-identifier hs-var">graph1</span></a></span><span>
</span><span id="line-345"></span><span>                        </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025710"><span class="hs-identifier hs-var">vr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025709"><span class="hs-identifier hs-var">rr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-346"></span><span>                                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegVirtual"><span class="hs-identifier hs-type">RegVirtual</span></a></span><span> </span><span id="local-6989586621681025710"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025710"><span class="hs-identifier hs-var">vr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UniqSet Reg -&gt; [Reg]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet Reg
</span><a href="#local-6989586621681025727"><span class="hs-identifier hs-var">set</span></a></span><span>
</span><span id="line-347"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-type">RegReal</span></a></span><span>    </span><span id="local-6989586621681025709"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025709"><span class="hs-identifier hs-var">rr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UniqSet Reg -&gt; [Reg]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet Reg
</span><a href="#local-6989586621681025727"><span class="hs-identifier hs-var">set</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-348"></span><span>                          </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-349"></span><span>
</span><span id="line-350"></span><span>   </span><span class="hs-keyword">in</span><span>   </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025714"><span class="hs-identifier hs-var">graph2</span></a></span><span>
</span><span id="line-351"></span><span>
</span><span id="line-352"></span><span>
</span><span id="line-353"></span><span class="hs-comment">-- | Add some coalesence edges to the graph</span><span>
</span><span id="line-354"></span><span class="hs-comment">--   Coalesences between virtual and real regs are recorded as preferences.</span><span>
</span><span id="line-355"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#graphAddCoalesce"><span class="hs-identifier hs-type">graphAddCoalesce</span></a></span><span>
</span><span id="line-356"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#Reg"><span class="hs-identifier hs-type">Reg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-357"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Color.Graph</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span>
</span><span id="line-358"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Color.Graph</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span>
</span><span id="line-359"></span><span>
</span><span id="line-360"></span><span id="graphAddCoalesce"><span class="annot"><span class="annottext">graphAddCoalesce :: (Reg, Reg)
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
</span><a href="GHC.CmmToAsm.Reg.Graph.html#graphAddCoalesce"><span class="hs-identifier hs-var hs-var">graphAddCoalesce</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681025707"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025707"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681025706"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025706"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681025705"><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025705"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-361"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-type">RegReal</span></a></span><span> </span><span id="local-6989586621681025704"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025704"><span class="hs-identifier hs-var">rr</span></a></span></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025707"><span class="hs-identifier hs-var">r1</span></a></span><span>
</span><span id="line-362"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegVirtual"><span class="hs-identifier hs-type">RegVirtual</span></a></span><span> </span><span id="local-6989586621681025703"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025703"><span class="hs-identifier hs-var">vr</span></a></span></span><span>         </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025706"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-363"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(VirtualReg, RegClass)
-&gt; RealReg
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
forall k cls color.
Uniquable k =&gt;
(k, cls) -&gt; color -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addPreference"><span class="hs-identifier hs-var">Color.addPreference</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025703"><span class="hs-identifier hs-var">vr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; RegClass
</span><a href="GHC.Platform.Reg.html#classOfVirtualReg"><span class="hs-identifier hs-var">classOfVirtualReg</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025703"><span class="hs-identifier hs-var">vr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025704"><span class="hs-identifier hs-var">rr</span></a></span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025705"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-364"></span><span>
</span><span id="line-365"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-type">RegReal</span></a></span><span> </span><span id="local-6989586621681025701"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025701"><span class="hs-identifier hs-var">rr</span></a></span></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025706"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-366"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegVirtual"><span class="hs-identifier hs-type">RegVirtual</span></a></span><span> </span><span id="local-6989586621681025700"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025700"><span class="hs-identifier hs-var">vr</span></a></span></span><span>         </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025707"><span class="hs-identifier hs-var">r1</span></a></span><span>
</span><span id="line-367"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(VirtualReg, RegClass)
-&gt; RealReg
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
forall k cls color.
Uniquable k =&gt;
(k, cls) -&gt; color -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addPreference"><span class="hs-identifier hs-var">Color.addPreference</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025700"><span class="hs-identifier hs-var">vr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; RegClass
</span><a href="GHC.Platform.Reg.html#classOfVirtualReg"><span class="hs-identifier hs-var">classOfVirtualReg</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025700"><span class="hs-identifier hs-var">vr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025701"><span class="hs-identifier hs-var">rr</span></a></span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025705"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-368"></span><span>
</span><span id="line-369"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegVirtual"><span class="hs-identifier hs-type">RegVirtual</span></a></span><span> </span><span id="local-6989586621681025699"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025699"><span class="hs-identifier hs-var">vr1</span></a></span></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025707"><span class="hs-identifier hs-var">r1</span></a></span><span>
</span><span id="line-370"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegVirtual"><span class="hs-identifier hs-type">RegVirtual</span></a></span><span> </span><span id="local-6989586621681025698"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025698"><span class="hs-identifier hs-var">vr2</span></a></span></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025706"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-371"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(VirtualReg, RegClass)
-&gt; (VirtualReg, RegClass)
-&gt; Graph VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
forall k cls color.
Uniquable k =&gt;
(k, cls) -&gt; (k, cls) -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addCoalesce"><span class="hs-identifier hs-var">Color.addCoalesce</span></a></span><span>
</span><span id="line-372"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025699"><span class="hs-identifier hs-var">vr1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; RegClass
</span><a href="GHC.Platform.Reg.html#classOfVirtualReg"><span class="hs-identifier hs-var">classOfVirtualReg</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025699"><span class="hs-identifier hs-var">vr1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-373"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025698"><span class="hs-identifier hs-var">vr2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; RegClass
</span><a href="GHC.Platform.Reg.html#classOfVirtualReg"><span class="hs-identifier hs-var">classOfVirtualReg</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025698"><span class="hs-identifier hs-var">vr2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-374"></span><span>                </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025705"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-375"></span><span>
</span><span id="line-376"></span><span>        </span><span class="hs-comment">-- We can't coalesce two real regs, but there could well be existing</span><span>
</span><span id="line-377"></span><span>        </span><span class="hs-comment">--      hreg,hreg moves in the input code. We'll just ignore these</span><span>
</span><span id="line-378"></span><span>        </span><span class="hs-comment">--      for coalescing purposes.</span><span>
</span><span id="line-379"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-type">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025707"><span class="hs-identifier hs-var">r1</span></a></span><span>
</span><span id="line-380"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-type">RegReal</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025706"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-381"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025705"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-cpp">

#if __GLASGOW_HASKELL__ &lt;= 810
</span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">otherwise</span><span>
</span><span id="line-385"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">panic</span><span> </span><span class="hs-string">&quot;graphAddCoalesce&quot;</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-388"></span><span>
</span><span id="line-389"></span><span class="hs-comment">-- | Patch registers in code using the reg -&gt; reg mapping in this graph.</span><span>
</span><span id="line-390"></span><span id="local-6989586621681026061"><span id="local-6989586621681026062"><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#patchRegsFromGraph"><span class="hs-identifier hs-type">patchRegsFromGraph</span></a></span><span>
</span><span id="line-391"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026062"><span class="hs-identifier hs-type">statics</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026061"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Instr.html#Instruction"><span class="hs-identifier hs-type">Instruction</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026061"><span class="hs-identifier hs-type">instr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-392"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#Platform"><span class="hs-identifier hs-type">Platform</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Color.Graph</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span>
</span><span id="line-393"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveCmmDecl"><span class="hs-identifier hs-type">LiveCmmDecl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026062"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026061"><span class="hs-identifier hs-type">instr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#LiveCmmDecl"><span class="hs-identifier hs-type">LiveCmmDecl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026062"><span class="hs-identifier hs-type">statics</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681026061"><span class="hs-identifier hs-type">instr</span></a></span></span></span><span>
</span><span id="line-394"></span><span>
</span><span id="line-395"></span><span id="patchRegsFromGraph"><span class="annot"><span class="annottext">patchRegsFromGraph :: forall statics instr.
(Outputable statics, Outputable instr, Instruction instr) =&gt;
Platform
-&gt; Graph VirtualReg RegClass RealReg
-&gt; LiveCmmDecl statics instr
-&gt; LiveCmmDecl statics instr
</span><a href="GHC.CmmToAsm.Reg.Graph.html#patchRegsFromGraph"><span class="hs-identifier hs-var hs-var">patchRegsFromGraph</span></a></span></span><span> </span><span id="local-6989586621681025692"><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025692"><span class="hs-identifier hs-var">platform</span></a></span></span><span> </span><span id="local-6989586621681025691"><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025691"><span class="hs-identifier hs-var">graph</span></a></span></span><span> </span><span id="local-6989586621681025690"><span class="annot"><span class="annottext">LiveCmmDecl statics instr
</span><a href="#local-6989586621681025690"><span class="hs-identifier hs-var">code</span></a></span></span><span>
</span><span id="line-396"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Reg -&gt; Reg)
-&gt; LiveCmmDecl statics instr -&gt; LiveCmmDecl statics instr
forall instr statics.
Instruction instr =&gt;
(Reg -&gt; Reg)
-&gt; LiveCmmDecl statics instr -&gt; LiveCmmDecl statics instr
</span><a href="GHC.CmmToAsm.Reg.Liveness.html#patchEraseLive"><span class="hs-identifier hs-var">patchEraseLive</span></a></span><span> </span><span class="annot"><span class="annottext">Reg -&gt; Reg
</span><a href="#local-6989586621681025689"><span class="hs-identifier hs-var">patchF</span></a></span><span> </span><span class="annot"><span class="annottext">LiveCmmDecl statics instr
</span><a href="#local-6989586621681025690"><span class="hs-identifier hs-var">code</span></a></span><span>
</span><span id="line-397"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-398"></span><span>        </span><span class="hs-comment">-- Function to lookup the hardreg for a virtual reg from the graph.</span><span>
</span><span id="line-399"></span><span>        </span><span id="local-6989586621681025689"><span class="annot"><span class="annottext">patchF :: Reg -&gt; Reg
</span><a href="#local-6989586621681025689"><span class="hs-identifier hs-var hs-var">patchF</span></a></span></span><span> </span><span id="local-6989586621681025665"><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025665"><span class="hs-identifier hs-var">reg</span></a></span></span><span>
</span><span id="line-400"></span><span>                </span><span class="hs-comment">-- leave real regs alone.</span><span>
</span><span id="line-401"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-type">RegReal</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025665"><span class="hs-identifier hs-var">reg</span></a></span><span>
</span><span id="line-402"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025665"><span class="hs-identifier hs-var">reg</span></a></span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span>                </span><span class="hs-comment">-- this virtual has a regular node in the graph.</span><span>
</span><span id="line-405"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RegVirtual"><span class="hs-identifier hs-type">RegVirtual</span></a></span><span> </span><span id="local-6989586621681025664"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025664"><span class="hs-identifier hs-var">vr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025665"><span class="hs-identifier hs-var">reg</span></a></span><span>
</span><span id="line-406"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681025663"><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025663"><span class="hs-identifier hs-var">node</span></a></span></span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
-&gt; VirtualReg -&gt; Maybe (Node VirtualReg RegClass RealReg)
forall k cls color.
Uniquable k =&gt;
Graph k cls color -&gt; k -&gt; Maybe (Node k cls color)
</span><a href="GHC.Data.Graph.Ops.html#lookupNode"><span class="hs-identifier hs-var">Color.lookupNode</span></a></span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025691"><span class="hs-identifier hs-var">graph</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025664"><span class="hs-identifier hs-var">vr</span></a></span><span>
</span><span id="line-407"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg -&gt; Maybe RealReg
forall k cls color. Node k cls color -&gt; Maybe color
</span><a href="GHC.Data.Graph.Base.html#nodeColor"><span class="hs-identifier hs-var hs-var">Color.nodeColor</span></a></span><span> </span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025663"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-408"></span><span>                        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681025660"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025660"><span class="hs-identifier hs-var">color</span></a></span></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegReal"><span class="hs-identifier hs-var">RegReal</span></a></span><span>    </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025660"><span class="hs-identifier hs-var">color</span></a></span><span>
</span><span id="line-409"></span><span>                        </span><span class="annot"><span class="annottext">Maybe RealReg
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; Reg
</span><a href="GHC.Platform.Reg.html#RegVirtual"><span class="hs-identifier hs-var">RegVirtual</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025664"><span class="hs-identifier hs-var">vr</span></a></span><span>
</span><span id="line-410"></span><span>
</span><span id="line-411"></span><span>                </span><span class="hs-comment">-- no node in the graph for this virtual, bad news.</span><span>
</span><span id="line-412"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-413"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Reg
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;patchRegsFromGraph: register mapping failed.&quot;</span></span><span>
</span><span id="line-414"></span><span>                        </span><span class="hs-special">(</span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;There is no node in the graph for register &quot;</span></span><span>
</span><span id="line-415"></span><span>                                </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Reg -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Reg
</span><a href="#local-6989586621681025665"><span class="hs-identifier hs-var">reg</span></a></span><span>
</span><span id="line-416"></span><span>                        </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">LiveCmmDecl statics instr -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">LiveCmmDecl statics instr
</span><a href="#local-6989586621681025690"><span class="hs-identifier hs-var">code</span></a></span><span>
</span><span id="line-417"></span><span>                        </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">(RealReg -&gt; SDoc)
-&gt; Triv VirtualReg RegClass RealReg
-&gt; Graph VirtualReg RegClass RealReg
-&gt; SDoc
forall k cls color.
(Uniquable k, Outputable k, Outputable cls, Outputable color) =&gt;
(color -&gt; SDoc) -&gt; Triv k cls color -&gt; Graph k cls color -&gt; SDoc
</span><a href="GHC.Data.Graph.Ppr.html#dotGraph"><span class="hs-identifier hs-var">Color.dotGraph</span></a></span><span>
</span><span id="line-418"></span><span>                                </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">RealReg
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;white&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-419"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform
-&gt; (RegClass -&gt; VirtualReg -&gt; Int)
-&gt; (RegClass -&gt; RealReg -&gt; Int)
-&gt; Triv VirtualReg RegClass RealReg
</span><a href="GHC.CmmToAsm.Reg.Graph.TrivColorable.html#trivColorable"><span class="hs-identifier hs-var">trivColorable</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025692"><span class="hs-identifier hs-var">platform</span></a></span><span>
</span><span id="line-420"></span><span>                                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; RegClass -&gt; VirtualReg -&gt; Int
</span><a href="GHC.CmmToAsm.Reg.Target.html#targetVirtualRegSqueeze"><span class="hs-identifier hs-var">targetVirtualRegSqueeze</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025692"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-421"></span><span>                                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Platform -&gt; RegClass -&gt; RealReg -&gt; Int
</span><a href="GHC.CmmToAsm.Reg.Target.html#targetRealRegSqueeze"><span class="hs-identifier hs-var">targetRealRegSqueeze</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681025692"><span class="hs-identifier hs-var">platform</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-422"></span><span>                                </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025691"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-423"></span><span>
</span><span id="line-424"></span><span>
</span><span id="line-425"></span><span class="hs-comment">-----</span><span>
</span><span id="line-426"></span><span class="hs-comment">-- for when laziness just isn't what you wanted...</span><span>
</span><span id="line-427"></span><span class="hs-comment">--  We need to deepSeq the whole graph before trying to colour it to avoid</span><span>
</span><span id="line-428"></span><span class="hs-comment">--  space leaks.</span><span>
</span><span id="line-429"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#seqGraph"><span class="hs-identifier hs-type">seqGraph</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Color.Graph</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-430"></span><span id="seqGraph"><span class="annot"><span class="annottext">seqGraph :: Graph VirtualReg RegClass RealReg -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqGraph"><span class="hs-identifier hs-var hs-var">seqGraph</span></a></span></span><span> </span><span id="local-6989586621681025658"><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025658"><span class="hs-identifier hs-var">graph</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Node VirtualReg RegClass RealReg] -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqNodes"><span class="hs-identifier hs-var">seqNodes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqFM VirtualReg (Node VirtualReg RegClass RealReg)
-&gt; [Node VirtualReg RegClass RealReg]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#nonDetEltsUFM"><span class="hs-identifier hs-var">nonDetEltsUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
-&gt; UniqFM VirtualReg (Node VirtualReg RegClass RealReg)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">Color.graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025658"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-431"></span><span>   </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-432"></span><span>
</span><span id="line-433"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#seqNodes"><span class="hs-identifier hs-type">seqNodes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Color.Node</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-434"></span><span id="seqNodes"><span class="annot"><span class="annottext">seqNodes :: [Node VirtualReg RegClass RealReg] -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqNodes"><span class="hs-identifier hs-var hs-var">seqNodes</span></a></span></span><span> </span><span id="local-6989586621681025655"><span class="annot"><span class="annottext">[Node VirtualReg RegClass RealReg]
</span><a href="#local-6989586621681025655"><span class="hs-identifier hs-var">ns</span></a></span></span><span>
</span><span id="line-435"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Node VirtualReg RegClass RealReg]
</span><a href="#local-6989586621681025655"><span class="hs-identifier hs-var">ns</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-436"></span><span>        </span><span class="hs-special">[</span><span class="hs-special">]</span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-437"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681025654"><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025654"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681025653"><span class="annot"><span class="annottext">[Node VirtualReg RegClass RealReg]
</span><a href="#local-6989586621681025653"><span class="hs-identifier hs-var">ns</span></a></span></span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqNode"><span class="hs-identifier hs-var">seqNode</span></a></span><span> </span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025654"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">[Node VirtualReg RegClass RealReg] -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqNodes"><span class="hs-identifier hs-var">seqNodes</span></a></span><span> </span><span class="annot"><span class="annottext">[Node VirtualReg RegClass RealReg]
</span><a href="#local-6989586621681025653"><span class="hs-identifier hs-var">ns</span></a></span><span>
</span><span id="line-438"></span><span>
</span><span id="line-439"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#seqNode"><span class="hs-identifier hs-type">seqNode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Color.Node</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-440"></span><span id="seqNode"><span class="annot"><span class="annottext">seqNode :: Node VirtualReg RegClass RealReg -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqNode"><span class="hs-identifier hs-var hs-var">seqNode</span></a></span></span><span> </span><span id="local-6989586621681025651"><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025651"><span class="hs-identifier hs-var">node</span></a></span></span><span>
</span><span id="line-441"></span><span>        </span><span class="hs-glyph">=</span><span>     </span><span class="annot"><span class="annottext">VirtualReg -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqVirtualReg"><span class="hs-identifier hs-var">seqVirtualReg</span></a></span><span>     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg -&gt; VirtualReg
forall k cls color. Node k cls color -&gt; k
</span><a href="GHC.Data.Graph.Base.html#nodeId"><span class="hs-identifier hs-var hs-var">Color.nodeId</span></a></span><span> </span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025651"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-442"></span><span>        </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">RegClass -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqRegClass"><span class="hs-identifier hs-var">seqRegClass</span></a></span><span>       </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg -&gt; RegClass
forall k cls color. Node k cls color -&gt; cls
</span><a href="GHC.Data.Graph.Base.html#nodeClass"><span class="hs-identifier hs-var hs-var">Color.nodeClass</span></a></span><span> </span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025651"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-443"></span><span>        </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Maybe RealReg -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqMaybeRealReg"><span class="hs-identifier hs-var">seqMaybeRealReg</span></a></span><span>   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg -&gt; Maybe RealReg
forall k cls color. Node k cls color -&gt; Maybe color
</span><a href="GHC.Data.Graph.Base.html#nodeColor"><span class="hs-identifier hs-var hs-var">Color.nodeColor</span></a></span><span> </span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025651"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-444"></span><span>        </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[VirtualReg] -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqVirtualRegList"><span class="hs-identifier hs-var">seqVirtualRegList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqSet VirtualReg -&gt; [VirtualReg]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg -&gt; UniqSet VirtualReg
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">Color.nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025651"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-445"></span><span>        </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[RealReg] -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqRealRegList"><span class="hs-identifier hs-var">seqRealRegList</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqSet RealReg -&gt; [RealReg]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg -&gt; UniqSet RealReg
forall k cls color. Node k cls color -&gt; UniqSet color
</span><a href="GHC.Data.Graph.Base.html#nodeExclusions"><span class="hs-identifier hs-var hs-var">Color.nodeExclusions</span></a></span><span> </span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025651"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-446"></span><span>        </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[RealReg] -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqRealRegList"><span class="hs-identifier hs-var">seqRealRegList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg -&gt; [RealReg]
forall k cls color. Node k cls color -&gt; [color]
</span><a href="GHC.Data.Graph.Base.html#nodePreference"><span class="hs-identifier hs-var hs-var">Color.nodePreference</span></a></span><span> </span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025651"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-447"></span><span>        </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[VirtualReg] -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqVirtualRegList"><span class="hs-identifier hs-var">seqVirtualRegList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqSet VirtualReg -&gt; [VirtualReg]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg -&gt; UniqSet VirtualReg
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">Color.nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node VirtualReg RegClass RealReg
</span><a href="#local-6989586621681025651"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-448"></span><span>              </span><span class="hs-comment">-- It's OK to use nonDetEltsUniqSet for seq</span><span>
</span><span id="line-449"></span><span>
</span><span id="line-450"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#seqVirtualReg"><span class="hs-identifier hs-type">seqVirtualReg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-451"></span><span id="seqVirtualReg"><span class="annot"><span class="annottext">seqVirtualReg :: VirtualReg -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqVirtualReg"><span class="hs-identifier hs-var hs-var">seqVirtualReg</span></a></span></span><span> </span><span id="local-6989586621681025639"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025639"><span class="hs-identifier hs-var">reg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025639"><span class="hs-identifier hs-var">reg</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-452"></span><span>
</span><span id="line-453"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#seqRealReg"><span class="hs-identifier hs-type">seqRealReg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-454"></span><span id="seqRealReg"><span class="annot"><span class="annottext">seqRealReg :: RealReg -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqRealReg"><span class="hs-identifier hs-var hs-var">seqRealReg</span></a></span></span><span> </span><span id="local-6989586621681025637"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025637"><span class="hs-identifier hs-var">reg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025637"><span class="hs-identifier hs-var">reg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-455"></span><span>
</span><span id="line-456"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#seqRegClass"><span class="hs-identifier hs-type">seqRegClass</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.Class.html#RegClass"><span class="hs-identifier hs-type">RegClass</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-457"></span><span id="seqRegClass"><span class="annot"><span class="annottext">seqRegClass :: RegClass -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqRegClass"><span class="hs-identifier hs-var hs-var">seqRegClass</span></a></span></span><span> </span><span id="local-6989586621681025636"><span class="annot"><span class="annottext">RegClass
</span><a href="#local-6989586621681025636"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RegClass
</span><a href="#local-6989586621681025636"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">RegClass -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-458"></span><span>
</span><span id="line-459"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#seqMaybeRealReg"><span class="hs-identifier hs-type">seqMaybeRealReg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-460"></span><span id="seqMaybeRealReg"><span class="annot"><span class="annottext">seqMaybeRealReg :: Maybe RealReg -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqMaybeRealReg"><span class="hs-identifier hs-var hs-var">seqMaybeRealReg</span></a></span></span><span> </span><span id="local-6989586621681025635"><span class="annot"><span class="annottext">Maybe RealReg
</span><a href="#local-6989586621681025635"><span class="hs-identifier hs-var">mr</span></a></span></span><span>
</span><span id="line-461"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe RealReg
</span><a href="#local-6989586621681025635"><span class="hs-identifier hs-var">mr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-462"></span><span>        </span><span class="annot"><span class="annottext">Maybe RealReg
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-463"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681025634"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025634"><span class="hs-identifier hs-var">r</span></a></span></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqRealReg"><span class="hs-identifier hs-var">seqRealReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025634"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-464"></span><span>
</span><span id="line-465"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#seqVirtualRegList"><span class="hs-identifier hs-type">seqVirtualRegList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-466"></span><span id="seqVirtualRegList"><span class="annot"><span class="annottext">seqVirtualRegList :: [VirtualReg] -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqVirtualRegList"><span class="hs-identifier hs-var hs-var">seqVirtualRegList</span></a></span></span><span> </span><span id="local-6989586621681025633"><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681025633"><span class="hs-identifier hs-var">rs</span></a></span></span><span>
</span><span id="line-467"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681025633"><span class="hs-identifier hs-var">rs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-468"></span><span>        </span><span class="hs-special">[</span><span class="hs-special">]</span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-469"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681025632"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025632"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681025631"><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681025631"><span class="hs-identifier hs-var">rs</span></a></span></span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">VirtualReg -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqVirtualReg"><span class="hs-identifier hs-var">seqVirtualReg</span></a></span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681025632"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">[VirtualReg] -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqVirtualRegList"><span class="hs-identifier hs-var">seqVirtualRegList</span></a></span><span> </span><span class="annot"><span class="annottext">[VirtualReg]
</span><a href="#local-6989586621681025631"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-470"></span><span>
</span><span id="line-471"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Graph.html#seqRealRegList"><span class="hs-identifier hs-type">seqRealRegList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-472"></span><span id="seqRealRegList"><span class="annot"><span class="annottext">seqRealRegList :: [RealReg] -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqRealRegList"><span class="hs-identifier hs-var hs-var">seqRealRegList</span></a></span></span><span> </span><span id="local-6989586621681025630"><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681025630"><span class="hs-identifier hs-var">rs</span></a></span></span><span>
</span><span id="line-473"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681025630"><span class="hs-identifier hs-var">rs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-474"></span><span>        </span><span class="hs-special">[</span><span class="hs-special">]</span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-475"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681025629"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025629"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681025628"><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681025628"><span class="hs-identifier hs-var">rs</span></a></span></span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqRealReg"><span class="hs-identifier hs-var">seqRealReg</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681025629"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">[RealReg] -&gt; ()
</span><a href="GHC.CmmToAsm.Reg.Graph.html#seqRealRegList"><span class="hs-identifier hs-var">seqRealRegList</span></a></span><span> </span><span class="annot"><span class="annottext">[RealReg]
</span><a href="#local-6989586621681025628"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-476"></span></pre></body></html>